Repository navigation
fix(android): Start a warm app start from onActivityPreCreated on API 29+ - #6719
runningcode wants to merge 2 commits into
Conversation
… 29+ The activity.load span starts in onActivityPreCreated, so a warm app.start transaction anchored at onActivityCreated started after its own first child. On API 29+ the first-activity logic now runs in onActivityPreCreated; older versions keep onActivityCreated, since pre-created callbacks don't exist there. Fixes JAVA-850 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR risk: mediumFor commit Main concerns: public contract, reach, data sent to Sentry. Rules that block low also fired:
This label is a hint for reviewers, not an approval. |
📲 Install BuildsAndroid
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 33c9028. Configure here.
| // onActivityPreCreated is only dispatched on API 29+ | ||
| if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { | ||
| onActivityCreating(savedInstanceState); | ||
| } |
There was a problem hiding this comment.
Late init misses warm start
Medium Severity
On API 29+, onActivityCreating only runs from onActivityPreCreated. The SDK_INT check treats that callback as always having run, but registerActivityLifecycleCallbacks during Activity.onCreate happens after PreCreated was already dispatched. onActivityCreated then skips classification and warm re-anchoring, so app start type stays unknown and the warm span is never restarted. This hits the SentryAndroid.init fallback when SentryPerformanceProvider is removed and Sentry is initialized in Activity.onCreate.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 33c9028. Configure here.


📜 Description
On API 29+,
AppStartMetricsnow decides the app start type and restarts the warm app start span inonActivityPreCreated. Below API 29, where that callback doesn't exist, it keeps doing this inonActivityCreated.💡 Motivation and Context
ActivityLifecycleIntegrationalready starts theactivity.loadspan inonActivityPreCreated. A warmapp.starttransaction anchored atonActivityCreatedtherefore started after its own first child. This was raised in review of #6687.💚 How did you test it?
Unit tests.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
🤖 Generated with Claude Code